package material.iteratorAndComponent.interal;

import material.iteratorAndComponent.MenuItem;

import java.util.ArrayList;
import java.util.Iterator;

public class PancakeHouseMenu implements Menu {
    ArrayList<MenuItem> menuItems;

    public PancakeHouseMenu() {
        menuItems = new ArrayList();
        addItem("K&amp;B煎饼早餐", "煎饼、炒蛋和吐司", true, 2.99);
        addItem("普通煎饼早餐", "煎饼、煎蛋、香肠", false, 2.99);
        addItem("蓝莓煎饼", "用新鲜蓝莓做成的煎饼", true, 3.59);
        addItem("华夫饼干", "蓝莓或草莓冰", true, 3.59);
    }

    /**
     * 要加入一个菜单项，煎饼屋的做法是创建一个新的菜单对象，传入每一个变量，然后将它加入ArrayList中
     *
     * @param name
     * @param description
     * @param vegetarian
     * @param price
     */
    public void addItem(String name, String description, boolean vegetarian, double price) {
        MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
        menuItems.add(menuItem);
    }

    @Override
    public Iterator createIterator() {
        return menuItems.iterator();
    }
}
